package com.psa.element;

import com.psa.system.R;
import com.psa.tool.SystemStatus;

/**
 * Created by david on 2014-06-06.
 */
public class SalesType {
    public static String CashSales = "C";
    public static String Damage = "D";
    public static String Expiration = "E";
    public static String Replacement = "R";
    public static String Sampling = "S";
    public static String Shortage = "H";
    public static String TradeOffer = "T";

    public static String getCode(String name){
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_cashsales)))return CashSales;
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_sampling)))return Sampling;
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_tradeoffer)))return TradeOffer;
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_replacement)))return Replacement;
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_damage)))return Damage;
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_expiration)))return Expiration;
        if (name.equals(SystemStatus.MainActivity.getString(R.string.st_shortage)))return Shortage;
        return "";
    }

    public static String getName(String code){
        if (code.equals(CashSales))return SystemStatus.MainActivity.getString(R.string.st_cashsales);
        if (code.equals(Sampling))return SystemStatus.MainActivity.getString(R.string.st_sampling);
        if (code.equals(TradeOffer))return SystemStatus.MainActivity.getString(R.string.st_tradeoffer);
        if (code.equals(Replacement))return SystemStatus.MainActivity.getString(R.string.st_replacement);
        if (code.equals(Damage))return SystemStatus.MainActivity.getString(R.string.st_damage);
        if (code.equals(Expiration))return SystemStatus.MainActivity.getString(R.string.st_expiration);
        if (code.equals(Shortage))return SystemStatus.MainActivity.getString(R.string.st_shortage);
        return "";
    }

    public String TypeCode;
    public String TypeName;

    public SalesType(){

    }

    public SalesType(String code, String name){
        TypeCode = code;
        TypeName = name;
    }

    @Override
    public String toString() {
        return TypeCode + "-" + TypeName;
    }
}
